.base {
  position: relative;
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--cui-spacings-byte);
  width: 100%;
  max-height: 200px;
  padding: var(--cui-spacings-kilo) var(--cui-spacings-mega);
  overflow-y: auto;
  background-color: var(--cui-bg-normal);
  border: 1px solid var(--cui-border-normal);
  border-radius: var(--cui-border-radius-byte);
  transition:
    box-shadow var(--cui-transitions-default),
    border var(--cui-transitions-default);
}

.base input {
  width: 100%;
  padding: 0 var(--cui-spacings-tera) 0 0;
  margin: 0;
  font-size: var(--cui-body-m-font-size);
  line-height: var(--cui-body-m-line-height);
  appearance: none;
  outline: 0;
  background-color: transparent;
  border: none;
  box-shadow: none;
}

.base:hover {
  border: 1px solid var(--cui-border-normal-hovered);
}

.base:focus-within {
  border: 1px solid var(--cui-border-accent);
  box-shadow: inset 0 0 0 1px var(--cui-border-accent);
}

.base input::placeholder {
  color: var(--cui-fg-placeholder);
  transition: color var(--cui-transitions-default);
}

.base:placeholder-shown {
  text-overflow: ellipsis;
}

/* Validations */

.invalid {
  border: 1px solid var(--cui-border-danger);
}

.invalid:hover {
  border: 1px solid var(--cui-border-danger-hovered);
}

.invalid:focus-within {
  border: 1px solid var(--cui-border-danger);
  box-shadow: inset 0 0 0 1px var(--cui-border-danger);
}

.warning {
  border: 1px solid var(--cui-border-warning);
}

.warning:hover {
  border: 1px solid var(--cui-border-warning-hovered);
}

.warning:focus-within {
  border: 1px solid var(--cui-border-warning);
  box-shadow: inset 0 0 0 1px var(--cui-border-warning);
}

/* Disabled */
.disabled,
.disabled-tag > div {
  color: var(--cui-fg-normal-disabled);
  background-color: var(--cui-bg-normal-disabled);
  border: 1px solid var(--cui-border-normal-disabled);
}

.readonly {
  background-color: var(--cui-bg-subtle-disabled);
}

.base input::-webkit-search-decoration,
.base input::-webkit-search-cancel-button,
.base input::-webkit-search-results-button,
.base input::-webkit-search-results-decoration {
  appearance: none;
}

/* Alignment */

.align-right {
  text-align: right;
}

.clear {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--cui-spacings-exa);
  height: var(--cui-spacings-exa);
  padding: var(--cui-spacings-kilo) var(--cui-spacings-mega);
  color: var(--cui-fg-subtle);
}

@media (max-width: 479px) {
  .base {
    max-height: 150px;
    overflow-y: auto;
  }
}
